import java.util.Scanner;

/**
 * Created by hps on 17-4-30.
 */
public class PostfixApp {
    public static void main(String[] args) {
        String input;

        while (true) {
            System.out.println("Enter infix: ");
            input = getString();
            if(input.equals(""))
                break;
            InToPost inToPost = new InToPost(input);
            String postfix = inToPost.doTrans();

            ParsePost parsePost = new ParsePost(postfix);
            int result = parsePost.doParse();
            System.out.println("Evaluates to " + result);
        }
    }

    public static String getString() {
        Scanner scanner = new Scanner(System.in);
        return scanner.nextLine();
    }
}
